var mainGridRole;
var mainGridUser;
var mainGridNoticeHost;
var mainGridOrganization;
var mainGridConditions;
var mainGridNoticeRole;
var mainGridNoticeUser;

/*显示审批节点属性信息*/
function loadExamine(){
	if(sessionStorage.getItem('examineJson') == "undefined"){
		return;
	}
	var properties = JSON.parse(sessionStorage.getItem('examineJson'));
	//同意方法
	var functionId = properties['functionId'];
	if(functionId){
		$.ajax({
			url:path+'/flow/function/getFunctionById',
			type:'post',
			dataType:'text',
			data:{functionId:functionId},
			success:function(functionName){
				$("#functionName").ligerComboBox().setText(functionName);
				$("#functionId").val(functionId);
			}
		});
	}
	//拒绝方法
	var disagreeFunctionId = properties["disagreeFunctionId"];
	if(disagreeFunctionId){
		$.ajax({
			url:'${_ctx}/flow/function/getFunctionById',
			type:'post',
			dataType:'text',
			data:{functionId:disagreeFunctionId},
			success:function(functionName){
				$("#disagreeFunctionName").ligerComboBox().setText(functionName);
				$("#disagreeFunctionId").val(disagreeFunctionId);
			}
		});
	}
	//同意节点
	var agreeNodeId = properties['agreeNodeId'];
	if(nodeObj[agreeNodeId]){
		var agreeNodeName = nodeObj[agreeNodeId].name;
		$("#agreeNode").val(agreeNodeId);
		var count=$("#node option").length;
		for(var i=0;i<count;i++){
			if($("#agreeNode").get(0).options[i].text == agreeNodeName) {
				$("#agreeNode").get(0).options[i].selected = true;
				break;
			}
		}
	}

	//拒绝节点
	var disagreeAgreeNodeId = properties["disagreeNodeId"];
	if(nodeObj[disagreeAgreeNodeId]){
		var disagreeAgreeNodeName = nodeObj[disagreeAgreeNodeId].name;
		$("#disagreeAgreeNode").val(disagreeAgreeNodeId);
		var count1=$("#node option").length;
		for(var i=0;i<count1;i++){
			if($("#disagreeAgreeNode").get(0).options[i].text == disagreeAgreeNodeName) {
				$("#disagreeAgreeNode").get(0).options[i].selected = true;
				break;
			}
		}
	}

	var viewPageId = properties['viewPageId'];
	if(viewPageId){
		$.ajax({
			url:'${_ctx}/flow/workPage/getPageNameById',
			type:'post',
			dataType:'json',
			data:{viewPageId:viewPageId},
			success:function(page){
				$("#viewPageName").ligerComboBox().setText(page.viewPageName);
				$("#viewPageId").val(viewPageId);
			}
		});
	}

	var allowStop = properties['allowStop'];
	var allowRecall = properties['allowRecall'];
	var allowHang = properties['allowHang'];
	if(allowStop == 1){
		$("#allowStop").attr("checked",true);
	}
	if(allowRecall == 1){
		$("#allowRecall").attr("checked",true);
	}
	if(allowHang == 1){
		$("#allowHang").attr("checked",true);
	}
	var radioId = properties['radioId'];
	var fkId = properties['fkId'];
	if(fkId == ""){
		return;
	}
	var fkIds = fkId.split(",");
	$("#"+radioId).click();
	if(radioId == "role"){//角色
		$("#role").attr("checked",true);
		for(var i=0;i<fkIds.length;i++){
			$.ajax({
				url:path+"/bap/featureRole/getFeturePoleByCode",
				type:"post",
				dataType:"json",
				data:{code:fkIds[i]},
				success:function(model){
					var manager = $("#mainGridRole").ligerGetGridManager();
					var firstRow = manager.getRow(0);
					manager.addRow({
						   id:model.role_id,
                           roleName:model.role_name,
                           roleCode:model.role_id
					}, firstRow, true);
				}
			});
		}
	} else if(radioId == "organizational"){//组织机构
		$("#organizational").attr("checked",true);
		for(var i=0;i<fkIds.length;i++){
			$.ajax({
				url:path+"/bap/organization/getOrganizationByCode",
				type:"post",
				dataType:"json",
				data:{code:fkIds[i]},
				success:function(model){
					var manager = $("#mainGridOrganization").ligerGetGridManager();
					var firstRow = manager.getRow(0);
					manager.addRow({
					    id:model.nodeId,
                        organizationName:model.nodeName,
                        organizationCode:model.nodeId
					}, firstRow, true);
				}
			});
		}
	} else if(radioId == "executive"){//自定义接收人
		$("#executive").attr("checked",true);
		for(var i=0;i<fkIds.length;i++){
			$.ajax({
				url:path+"/bap/user/getUserAccount",
				type:"post",
				dataType:"json",
				data:{account:fkIds[i]},
				success:function(model){
					var manager = $("#mainGridUser").ligerGetGridManager();
					var firstRow = manager.getRow(0);
					manager.addRow({
					    id:model.userId,
                        account:model.account,
                        userName:model.userName,
                        userType:model.userName
					},firstRow, true);
				}
			});
		}
	}else if(radioId == "promoter"){//流程发起人
		$("#promoter").attr("checked",true);
	}
}
/*加载通知*/
function loadNotice(){
  if(sessionStorage.getItem('examineJson') == "undefined"){
    return;
  }
  var properties = JSON.parse(sessionStorage.getItem('examineJson'));
  var notices = properties["notices"];
  if(notices){
    var radioId = notices[0].radioId;
    var title = notices[0].title;
    var content = notices[0].content;
    var fkId = notices[0].fkId;
    var fkIds = fkId.split(",");
$("#"+radioId).click();
if(radioId =="noticeHost"){
  $("#noticeHostTitle").val(title);
  $("#noticeHostContent").val(content);
  for(var i=0;i<fkIds.length;i++){
    $.ajax({
      url:path+"/bap/position/getPositionByCode",
  type:"post",
  dataType:"json",
  data:{code:fkIds[i]},
  success:function(model){
    var manager = $("#mainGridNoticeHost").ligerGetGridManager();
        var firstRow = manager.getRow(0);
        manager.addRow({
          id:model.code,
          hostName:model.name,
          hostCode:model.code,
          organization:model.organization.name
        }, firstRow, true);
      }
    });
  }
}else if(radioId =="noticeRole"){
  $("#noticeRoleTitle").val(title);
  $("#noticeRoleContent").val(content);
  for(var i=0;i<fkIds.length;i++){
    $.ajax({
      url:path+"/bap/featureRole/getFeturePoleByCode",
  type:"post",
  dataType:"json",
  data:{code:fkIds[i]},
  success:function(model){
    var manager = $("#mainGridNoticeRole").ligerGetGridManager();
        var firstRow = manager.getRow(0);
        manager.addRow({
          id:model.code,
          roleName:model.name,
          roleCode:model.code
        }, firstRow, true);
      }
    });
  }
}else if(radioId =="noticeExecutive"){
  $("#noticeUserTitle").val(title);
  $("#noticeUserContent").val(content);
  for(var i=0;i<fkIds.length;i++){
    $.ajax({
      url:path+"/bap/user/getUserAccount",
  type:"post",
  dataType:"json",
  data:{account:fkIds[i]},
  success:function(model){
    var manager = $("#mainGridNoticeUser").ligerGetGridManager();
        var firstRow = manager.getRow(0);
        manager.addRow({
          id:model.userId,
          account:model.account,
          userName:model.userName,
          userType:model.userType
        }, firstRow, true);
      }
    });
  }
}else if(radioId =="noticePromoter"){
  $("#noticeTitle").val(title);
  $("#noticeContent").val(content);
    }
  }
}

var nodeStr = sessionStorage.getItem("nodeStr");
var nodeObj = JSON.parse(nodeStr);

/*创建通知 json对像*/
var isNoticesNull
function noticesJson(){
  isNoticesNull = true;
  var str = "";
  var fkType = "";
  var radioId = "";
  var radios = $("input[name=notice]");
  for(var i=0;i<radios.length;i++){
    if(radios[i].checked){
      fkType = radios[i].value;
      radioId = radios[i].id;
    }
  }
  var noticeJson =[];
  //岗位
  if($("#noticeHost").get(0).checked){
var manager = $("#mainGridNoticeHost").ligerGetGridManager();
var rows = manager.getData();
var hosts = [];
$(rows).each(function () {
  hosts.push(this.hostCode);
});
str = hosts.join(",");
if((str == "" && $("#noticeHostTitle").val()=="" && $("#noticeHostContent").val() == "") || (str != "" && $("#noticeHostTitle").val()!="" && $("#noticeHostContent").val() != "") ){
  noticeJson = [{radioId:radioId,fkId:str,fkType:fkType,noticeWay:$("#noticeHostWay").val(),
title:$("#noticeHostTitle").val(),content:$("#noticeHostContent").val()}];
}else if($("#noticeHostTitle").val()==""){
  isNoticesNull = false;
  BAP.showWarn("通知标题不能为空")
}else if($("#noticeHostContent").val()==""){
  isNoticesNull = false;
  BAP.showWarn("通知内容不能为空")
}else if(str==""){
  isNoticesNull = false;
  BAP.showWarn("请选择通知接收人")
    }
  }else if($("#noticeRole").get(0).checked){//角色
var manager = $("#mainGridNoticeRole").ligerGetGridManager();
var rows = manager.getData();
var roles = [];
$(rows).each(function () {
  roles.push(this.roleCode);
});
str = roles.join(",");
if((str == "" && $("#noticeRoleTitle").val()=="" && $("#noticeRoleContent").val() == "") || (str != "" && $("#noticeRoleTitle").val()!="" && $("#noticeRoleContent").val() != "")){
  noticeJson = [{radioId:radioId,fkId:str,fkType:fkType,noticeWay:$("#noticeRoleWay").val(),
title:$("#noticeRoleTitle").val(),content:$("#noticeRoleContent").val()}];
}else if($("#noticeRoleTitle").val()==""){
  isNoticesNull = false;
  BAP.showWarn("通知标题不能为空")
}else if($("#noticeRoleContent").val()==""){
  isNoticesNull = false;
  BAP.showWarn("通知内容不能为空")
}else if(str==""){
  isNoticesNull = false;
  BAP.showWarn("请选择通知接收人")
    }
  }else if($("#noticeExecutive").get(0).checked){//自定义执行人
var manager = $("#mainGridNoticeUser").ligerGetGridManager();
var rows = manager.getData();
var roles = [];
$(rows).each(function () {
  roles.push(this.account);
});
str = roles.join(",");
if((str == "" && $("#noticeUserTitle").val()=="" && $("#noticeUserContent").val() == "") || (str != "" && $("#noticeUserTitle").val()!="" && $("#noticeUserContent").val() != "")){
  noticeJson = [{radioId:radioId,fkId:str,fkType:fkType,noticeWay:$("#noticeUserWay").val(),
title:$("#noticeUserTitle").val(),content:$("#noticeUserContent").val()}];
}else if($("#noticeUserTitle").val()==""){
  isNoticesNull = false;
  BAP.showWarn("通知标题不能为空")
}else if($("#noticeUserContent").val()==""){
  isNoticesNull = false;
  BAP.showWarn("通知内容不能为空")
}else if(str==""){
  isNoticesNull = false;
  BAP.showWarn("请选择通知接收人")
    }
  }else if($("#noticePromoter").get(0).checked){//流程发起人
if(($("#noticeTitle").val()=="" && $("#noticeContent").val() == "") || ($("#noticeTitle").val()!="" && $("#noticeContent").val() != "")){
  noticeJson = [{radioId:radioId,fkId:'${currentUser}',fkType:fkType,noticeWay:$("#noticeWay").val(),
title:$("#noticeTitle").val(),content:$("#noticeContent").val()}];
}else if($("#noticeTitle").val()==""){
  isNoticesNull = false;
  BAP.showWarn("通知标题不能为空")
}else if($("#noticeContent").val()==""){
  isNoticesNull = false;
  BAP.showWarn("通知内容不能为空")
    }
  }
  /*判断： 把没有值的属性删除*/
  for(var k in noticeJson[0]){
    if(noticeJson[0][k]==undefined || noticeJson[0][k] == "" || noticeJson[0][k] == null){
  noticeJson = "";
      break;
    }
  }
  return noticeJson;
}

/*创建单个节点的json对象*/
function createJson(){
  var fkType="";
  var radioId="";
  var allowStop = 0;
  var allowRecall = 0;
  var allowHang = 0;
  var radios = $("input[name=fkType]");
  for(var i=0;i<radios.length;i++){
    if(radios[i].checked){
      fkType = radios[i].value;
      radioId = radios[i].id;
    }
  }
  if($("#allowStop").get(0).checked){
    allowStop = 1;
  }
  if($("#allowRecall").get(0).checked){
    allowRecall = 1;
  }
  if($("#allowHang").get(0).checked){
    allowHang = 1;
  }

  //定义json对象的模型，并赋值
  var ret = {radioId:radioId,type:nodeObj[currentNodeId].type,fkId:fkId(),fkType:fkType, allowStop:allowStop, allowRecall:allowRecall,
allowHang:allowHang, functionId:$("#functionId").val(),disagreeFunctionId:$("#disagreeFunctionId").val(),agreeNodeId:$("#agreeNode").val(),
disagreeNodeId:$("#disagreeAgreeNode").val(),viewPageId:$("#viewPageId").val(),notices:noticesJson()};
  /*判断： 把没有值的属性删除*/
  for(var k in ret){
    if(ret[k]==undefined || ret[k] == "" || ret[k] == null || JSON.stringify(ret[k]) =="{}"){
      delete ret[k];
    }
  }
  return ret;
}

/*流程的执行人code*/
function fkId(){
	  var str = "";
	   if($("#role").get(0).checked){//角色
	        var manager = $("#mainGridRole").ligerGetGridManager();
	        var rows = manager.getData();
	        var roles = [];
	        $(rows).each(function () {
	            roles.push(this.id);
	        });
	        str = roles.join(",");
	    }else if($("#organizational").get(0).checked){//组织机构
	        var manager = $("#mainGridOrganization").ligerGetGridManager();
	        var rows = manager.getData();
	        var roles = [];
	        $(rows).each(function () {
	            roles.push(this.id);
	        });
	        str = roles.join(",");
	    }else if($("#executive").get(0).checked){//自定义执行人
	        var manager = $("#mainGridUser").ligerGetGridManager();
	        var rows = manager.getData();
	        var roles = [];
	        $(rows).each(function () {
	            roles.push(this.id);
	        });
	        str = roles.join(",");
	    }else if($("#promoter").get(0).checked){//流程发起人
	        str = '${currentUser}';
	    }
	    return str;
}


/*角色*/
function f_addRloe() {
  $.ligerDialog.open({title: "选择角色", width: 450,height:450, allowClose: false, url: path+'/html/flowpages/featureList.jsp',
buttons: [
  { text: '确定', onclick: function (item, dialog) {
var roles = dialog.frame.f_roleJson();

for(var i=0;i<roles.length;i++){
  var manager = $("#mainGridRole").ligerGetGridManager();
      var firstRow = manager.getRow(0);
      var data = manager.getData();
      var isOk = true;
      $(data).each(function () {
        if(this.id == roles[i].id){
          isOk = false;
        }
      });
      if(isOk){
    
        manager.addRow({
        	roleCode:roles[i].id,
    		id:roles[i].id,
    		roleName:roles[i].name
        }, firstRow, true);
      }
    }

    dialog.close();
  }
  },
  { text: '关闭', onclick: function (item, dialog) {
        dialog.close();
      }
      }
    ]
  });
}
/*删除角色*/
function f_deleteRole(){
  var manager = $("#mainGridRole").ligerGetGridManager();
  manager.deleteSelectedRow();
}

/**
 *组织机构
 */
function f_addOrganization() {
  $.ligerDialog.open({title: "选择组织机构", width: 450,height:450, allowClose: false, url: path+'/html/flowpages/flow_OrganizationList.jsp',
buttons: [
  { text: '确定', onclick: function (item, dialog) {
var organizations = dialog.frame.f_organizationJson();
for(var i=0;i<organizations.length;i++){
  var manager = $("#mainGridOrganization").ligerGetGridManager();
      var firstRow = manager.getRow(0);
      var data = manager.getData();
      var isOk = true;
      $(data).each(function () {
        if(this.id == organizations[i].id){
          isOk = false;
        }
      });
      if(isOk){
        manager.addRow({
        	 id:organizations[i].id,
             organizationName:organizations[i].name,
             organizationCode:organizations[i].id
        }, firstRow, true);
      }
    }
    dialog.close();
  }
  },
  { text: '关闭', onclick: function (item, dialog) {
        dialog.close();
      }
      }
    ]
  });
}
/*删除机构*/
function f_deleteOrganization(){
  var manager = $("#mainGridOrganization").ligerGetGridManager();
  manager.deleteSelectedRow();
}

/**
 *自定义执行人
 */
function f_addUser() {
  $.ligerDialog.open( {width: 450,height:450, allowClose: false, url: path+'/html/flowpages/flow_userList.jsp',
buttons: [
  { text: '确定', onclick: function (item, dialog) {
var users = dialog.frame.f_userJson();
for(var i=0;i<users.length;i++){
  var manager = $("#mainGridUser").ligerGetGridManager();
      var firstRow = manager.getRow(0);
      var data = manager.getData();
      var isOk = true;
      $(data).each(function () {
        if(this.id == users[i].id){
          isOk = false;
        }
      });
      if(isOk){
        manager.addRow({
            id:users[i].id,
            account:users[i].account,
            userName:users[i].userName,
            userType:users[i].userType
        }, firstRow, true);
      }
    }
    dialog.close();
  }
  },
  { text: '关闭', onclick: function (item, dialog) {
        dialog.close();
      }
      }
    ]
  });
}
/*删除自定义执行人*/
function f_deleteUser(){
  var manager = $("#mainGridUser").ligerGetGridManager();
  manager.deleteSelectedRow();
}



/**
 *添加通知接收角色
 */
function f_addNoticeRloe() {
  $.ligerDialog.open({title: "选择角色", width: 450,height:450, allowClose: false, url: path+'/bap/user/getUserAccount',
buttons: [
  { text: '确定', onclick: function (item, dialog) {
var roles = dialog.frame.f_roleJson();
for(var i=0;i<roles.length;i++){
  var manager = $("#mainGridNoticeRole").ligerGetGridManager();
      var firstRow = manager.getRow(0);
      var data = manager.getData();
      var isOk = true;
      $(data).each(function () {
        if(this.roleCode == roles[i].code){
          isOk = false;
        }
      });
      if(isOk){
        manager.addRow({
          id:roles[i].code,
          roleName:roles[i].name,
          roleCode:roles[i].code
        }, firstRow, true);
      }
    }

    dialog.close();
  }
  },
  { text: '关闭', onclick: function (item, dialog) {
        dialog.close();
      }
      }
    ]
  });
}
/*删除通知接收角色*/
function f_deleteNoticeRole(){
  var manager = $("#mainGridNoticeRole").ligerGetGridManager();
  manager.deleteSelectedRow();
}

/**
 *添加通知接收人
 */
function f_addNoticeUser() {
  $.ligerDialog.open( {width: 450,height:450, allowClose: false, url: path+'/html/flowpages/flow_userList.jsp',
buttons: [
  { text: '确定', onclick: function (item, dialog) {
var users = dialog.frame.f_userJson();
for(var i=0;i<users.length;i++){
  var manager = $("#mainGridNoticeUser").ligerGetGridManager();
      var firstRow = manager.getRow(0);
      var data = manager.getData();
      var isOk = true;
      $(data).each(function () {
        if(this.id == users[i].id){
          isOk = false;
        }
      });
      if(isOk){
        manager.addRow({
            id:users[i].account,
            account:users[i].account,
            userName:users[i].userName,
            userType:users[i].userType
        }, firstRow, true);
      }
    }
    dialog.close();
  }
  },
  { text: '关闭', onclick: function (item, dialog) {
        dialog.close();
      }
      }
    ]
  });
}
/*删除通知接收人*/
function f_deleteNoticeUser(){
  var manager = $("#mainGridNoticeUser").ligerGetGridManager();
  manager.deleteSelectedRow();
}

	/*获取下个节点的id*/
	function nextNodeId(){
  var agreeNodeId = $("#agreeNode").val();
  var disagreeAgreeId = $("#disagreeAgreeNode").val();
  var nextNodes = [];
  nextNodes.push(agreeNodeId);
  nextNodes.push(disagreeAgreeId);
  return nextNodes;
}
$(function(){
	$("textarea").css({"min-width":"450px","min-height":"100px","max-width":"450px","max-height":"100px"});
	$("input[type=button]").css({"background":"#ffffff","display":"inline-block","cursor":"pointer"});//按钮的样式
	/*绑定同意方法下拉框*/
	$("#functionName").ligerComboBox({
		url: path+'/flow/function/getComboBoxData?processId='+processId,
		valueField: 'id',
		textField: 'functionName',
		valueFieldID: 'functionId',
		selectBoxWidth: 173,
		width: 173,
		highLight:true,
		cancelable:true
	});
	/*绑定拒绝方法下拉框*/
	$("#disagreeFunctionName").ligerComboBox({
		url: path + '/flow/function/getComboBoxData?processId='+processId,
		valueField: 'id',
		textField: 'functionName',
		valueFieldID: 'disagreeFunctionId',
		selectBoxWidth: 173,
		width: 173,
		highLight:true,
		cancelable:true
	});
	
	/*绑定查看页面下拉框*/
	$("#viewPageName").ligerComboBox({
		url:path+'/flow/workPage/getComboBoxData?processId='+processId+'&type=1',
		valueField: 'id',
		textField: 'pageName',
		valueFieldID: 'viewPageId',
		selectBoxWidth: 173,
		width: 173,
		highLight:true,
		cancelable:true
	});
	/*岗位列表*/
	$("#mainGrid").ligerGrid({
		columns: [
			{ display: 'id', name: 'id', hide: true, width: 60 },
			{ display: '序号', width: 40, render: function (rowData, rowindex, value, column, rowid, page, pagesize) { return (page - 1) * pagesize + rowindex + 1; } },
			{ display: '岗位名称', name: 'hostName', align: 'center', width: 160 },
			{ display: '岗位代码', name: 'hostCode', align: 'center', width: 140 },
			{ display: '组织机构', name: 'organization', align: 'center', width: 140 }
		],
		width: '100%', heightDiff: -1,height:'50%',
		usePager:false,
		checkbox:true
	});
	/*接收通知岗位列表*/
	$("#mainGridNoticeHost").ligerGrid({
		columns: [
			{ display: 'id', name: 'id', hide: true, width: 60 },
			{ display: '序号', width: 40, render: function (rowData, rowindex, value, column, rowid, page, pagesize) { return (page - 1) * pagesize + rowindex + 1; } },
			{ display: '岗位名称', name: 'hostName', align: 'center', width: 160 },
			{ display: '岗位代码', name: 'hostCode', align: 'center', width: 140 },
			{ display: '组织机构', name: 'organization', align: 'center', width: 140 }
		],
		width: '100%', heightDiff: -1,height:'50%',
		usePager:false
	});
	
	/*角色列表*/
	$("#mainGridRole").ligerGrid({
		columns: [
			{ display: 'id', name: 'id', hide: true, width: 60 },
			{ display: '序号', width: 40, render: function (rowData, rowindex, value, column, rowid, page, pagesize) { return (page - 1) * pagesize + rowindex + 1; } },
			{ display: '角色名称', name: 'roleName', align: 'center', width: 200 },
		],
		width: '100%', heightDiff: -1,height:'50%',
		usePager:false,
		checkbox:true
	});
	/*接收通知角色列表*/
	$("#mainGridNoticeRole").ligerGrid({
		columns: [
			{ display: 'id', name: 'id', hide: true, width: 60 },
			{ display: '序号', width: 40, render: function (rowData, rowindex, value, column, rowid, page, pagesize) { return (page - 1) * pagesize + rowindex + 1; } },
			{ display: '角色名称', name: 'roleName', align: 'center', width: 200 },
			{ display: '角色代码', name: 'roleCode', align: 'center', width: 200 },
		],
		width: '100%', heightDiff: -1,height:'50%',
		usePager:false
	});
	
	/*组织机构*/
	$("#mainGridOrganization").ligerGrid({
		columns: [
			{ display: 'id', name: 'id', hide: true, width: 60 },
			{ display: '序号', width: 40, render: function (rowData, rowindex, value, column, rowid, page, pagesize) { return (page - 1) * pagesize + rowindex + 1; } },
			{ display: '机构名称', name: 'organizationName', align: 'center', width: 200 },
			{ display: '机构代码', name: 'organizationCode', align: 'center', width: 200 },
		],
		width: '100%', heightDiff: -1,height:'50%',
		usePager:false,
		checkbox:true
	});
	
	/*自定义执行人*/
	$("#mainGridUser").ligerGrid({
		columns: [
			{ display: 'id', name: 'id', hide: true, width: 60 },
			{ display: '序号', width: 40, render: function (rowData, rowindex, value, column, rowid, page, pagesize) { return (page - 1) * pagesize + rowindex + 1; } },
			{ display: '帐号', name: 'account', align: 'center',width:100},
			{ display: '名称', name: 'userName', align: 'center',width:100},
			{ display: '类型', name: 'userType', align: 'center',width:60, render: function (row) {return 'employee' == row['userType'] ? '内部员工' : '合作伙伴'}},
		],
		width: '100%', heightDiff: -1,height:'50%',
		usePager:false,
		checkbox:true
	});
	/*接收通知人列表*/
	$("#mainGridNoticeUser").ligerGrid({
		columns: [
			{ display: 'id', name: 'id', hide: true, width: 60 },
			{ display: '序号', width: 40, render: function (rowData, rowindex, value, column, rowid, page, pagesize) { return (page - 1) * pagesize + rowindex + 1; } },
			{ display: '帐号', name: 'account', align: 'center',width:100},
			{ display: '名称', name: 'userName', align: 'center',width:100},
			{ display: '类型', name: 'userType', align: 'center',width:60, render: function (row) {return 'employee' == row['userType'] ? '内部员工' : '合作伙伴'}},
		],
		width: '100%', heightDiff: -1,height:'50%',
		usePager:false
	});
	
	/*
	*接收并初始化节点
	*/
	$("#currentNodeName").val(nodeObj[currentNodeId].name);
	for(var node in nodeObj){
		var nodeChild = nodeObj[node];
		if(nodeChild.type != "start round" && node != currentNodeId){
			$("#disagreeAgreeNode").append("<option value='"+node+"'>"+nodeChild.name+"</option>");
			$("#agreeNode").append("<option value='"+node+"'>"+nodeChild.name+"</option>");
		}
	}
	$("#navtab1").ligerTab();
	
	/*任务执行人单选按钮的切换*/
	$("input[name=fkType]").click(function(){
		$(".post:eq("+$(this).index()+")").show().siblings().hide();
	});
	/*通知接收人单选按钮的切换*/
	$("input[name=notice]").click(function(){
		$(".notice:eq("+$(this).index()+")").show().siblings().hide();
	});
	loadExamine();
	loadNotice();
});